<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body></body>
  <script>
    var p1 = {
      name: "张三",
    };
    p1.tel = function (date) {
      //为p1增加一个方法tel
      console.log(date+this.name + "给李四打电话");
      console.log(this); //通过call被p2调用时指向p2
    };
    var p2 = {
      name: "王老五",
    };
    p1.tel.call(p2,"今天"); //p2借p1的tel方法 this指向了p2这个对象
  </script>
</html>
